/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.base.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.common.utils.excel.annotation.ExcelField;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 顾客Entity
 * @author liujiang
 * @version 2013-06-05
 */
@Entity
@Table(name = "customer")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Customer extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 				// 编号
	private String name; 			// 客户姓名
	private String nickname; 			// 客户备注名
	private int gender;				// 性别：0 - 女 1 - 男
	private Date birthday;			// 参数权重
	private Long weight;			//目前体重
	private String mobile;			//客户手机号
	private String phone;			//客户电话号码
	private String address;			//客户家庭住址
	private Store store;			//隶属店面编号
	private String email;			//电子邮箱
	private int marry;				//婚姻状况：0 - 未婚1 - 已婚
	private int childs;				//孩子数量
	private int workplace;			//工作场所：0 - 户外工作1 - 室内工作
	private int live_condition; 	// 安静1 - 普通2 - 嘈杂
	private String work_nature;     //工作性质

	public Customer() {
	}

	public Customer(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	@Length(min=1, max=32)
	@NotNull(message="客户姓名不能为空")
	@ExcelField(title="姓名", align=2, sort=10)
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
    public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="store_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}
	
	@NotNull(message="生日不能为空")
	@ExcelField(title="生日", align=2, sort=20)
	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Long getWeight() {
		return weight;
	}

	public void setWeight(Long weight) {
		this.weight = weight;
	}

	@NotNull(message="手机号码不能为空")
	@Length(min =10, max = 12, message = "手机号码格式不正确")
	@ExcelField(title="手机号码", align=2, sort=30)
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public int getMarry() {
		return marry;
	}

	public void setMarry(int marry) {
		this.marry = marry;
	}

	public int getChilds() {
		return childs;
	}

	public void setChilds(int childs) {
		this.childs = childs;
	}

	public int getWorkplace() {
		return workplace;
	}

	public void setWorkplace(int workplace) {
		this.workplace = workplace;
	}

	public int getLive_condition() {
		return live_condition;
	}

	public void setLive_condition(int live_condition) {
		this.live_condition = live_condition;
	}

	public String getWork_nature() {
		return work_nature;
	}

	public void setWork_nature(String work_nature) {
		this.work_nature = work_nature;
	}
}


